/*  zwt */
package cn.mandy.sysadmin.model;

import cn.mandy.sysadmin.common.util.MandyTree;
import io.swagger.annotations.ApiModelProperty;

import java.util.Date;
import java.util.List;

public class MonitorTask implements MandyTree<MonitorTask> {
    private List<MonitorTask> children;

    @Override
    public List<MonitorTask> getChildren() {
        return children;
    }

    @Override
    public void setChildren(List<MonitorTask> children) {
        this.children = children;
    }

    private Long id;

    @ApiModelProperty(value = "作业组整体运行时(任务组), 子作业此字段值等于任务组id, 单独运行时等于id")
    private Long parentId;

    @ApiModelProperty(value = "重启任务的原任务ID,  启动与停止命令分开执行时，停止命令也记录原任务ID")
    private Long oldId;

    @ApiModelProperty(value = "重做标志 0  未重做 0 已重做")
    private String hasRedo;

    @ApiModelProperty(value = "作业ID")
    private Long jobId;

    @ApiModelProperty(value = "同 cfg_job.job_type")
    private String jobType;

    @ApiModelProperty(value = "作业名")
    private String jobName;

    @ApiModelProperty(value = "运行主机名")
    private String hostName;

    @ApiModelProperty(value = "同cfg_job_crontab.action_type")
    private String actionType;

    @ApiModelProperty(value = "运行命令,  真正执行命令时, 才从cfg_job中获取")
    private String startCommand;

    @ApiModelProperty(value = "停止命令,  真正执行命令时, 才从cfg_job中获取")
    private String stopCommand;

    @ApiModelProperty(value = "运行顺序号, 来自cfg_job.ordinal_position2")
    private Integer ordinalPosition;

    @ApiModelProperty(value = "计划ID")
    private Long crontabId;

    @ApiModelProperty(value = "计划名称")
    private String crontabName;

    @ApiModelProperty(value = "计划时间, 等于schedule_start_time(优先)或者scheduler_stop_time, 用于排序")
    private Date scheduleTime;

    @ApiModelProperty(value = "计划启动时间,  不为空且到达时间(最近一条)，开始start_command命令")
    private Date scheduleStartTime;

    @ApiModelProperty(value = "计划停止时间,  不为空且到达时间(最近一条)，开始stop_command命令")
    private Date scheduleStopTime;

    @ApiModelProperty(value = "任务创建模式 0 调度计划 1 调度重跑 2 手动模式")
    private String createMode;

    @ApiModelProperty(value = "发出启动命令时间")
    private Date launchTime;

    @ApiModelProperty(value = "实际启动时间")
    private Date startTime;

    @ApiModelProperty(value = "关闭模式 0 正常到时结束 1 命令结束 ")
    private String shutdownMode;

    @ApiModelProperty(value = "发出停止命令时间")
    private Date shutdownTime;

    @ApiModelProperty(value = "实际运行结束时间")
    private Date stopTime;

    @ApiModelProperty(value = "日志文件名")
    private String logFileName;

    @ApiModelProperty(value = "运行状态 0 未运行, 1 就绪状态执行运行命令, 2 正在运行, 3 运行正常结束, 4,  错过停止时间  5 运行异常结束, 6 错过运行时间, 7 等待启动条件成立, 8 作业超时, 9 等待执行停止命令, c 已经执行运行命令, 待检测运行状态.  w 停止命令已经执行, 等待进程结束. e 未运行就停止, d 无法停止, w状态如果持续超过1分钟  常驻内存作业的状态有(0,1,2,3,4,5,6,7,9,w,c,d,e)  计划调度作业的状态有(0,1,2,3,5,6,7,8,e)")
    private String status;

    @ApiModelProperty(value = "是否已经产生重启任务 0 没有产生 1 已经产生")
    private String restartTaskCreated;

    @ApiModelProperty(value = "实例运行进程号")
    private Integer instancePid;

    @ApiModelProperty(value = "返回码, 要与status同类型, 在依赖中使用")
    private String returnCode;

    @ApiModelProperty(value = "冲突标志 0 一致 1 有冲突(有冲突时显示实时状态)")
    private String conflictFlag;

    private String remark;

    @ApiModelProperty(value = "创建本记录时间")
    private Date createTime;

    private Date modifyTime;

    private static final long serialVersionUID = 1L;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public Long getParentId() {
        return parentId;
    }

    public void setParentId(Long parentId) {
        this.parentId = parentId;
    }

    public Long getOldId() {
        return oldId;
    }

    public void setOldId(Long oldId) {
        this.oldId = oldId;
    }

    public String getHasRedo() {
        return hasRedo;
    }

    public void setHasRedo(String hasRedo) {
        this.hasRedo = hasRedo;
    }

    public Long getJobId() {
        return jobId;
    }

    public void setJobId(Long jobId) {
        this.jobId = jobId;
    }

    public String getJobType() {
        return jobType;
    }

    public void setJobType(String jobType) {
        this.jobType = jobType;
    }

    public String getJobName() {
        return jobName;
    }

    public void setJobName(String jobName) {
        this.jobName = jobName;
    }

    public String getHostName() {
        return hostName;
    }

    public void setHostName(String hostName) {
        this.hostName = hostName;
    }

    public String getActionType() {
        return actionType;
    }

    public void setActionType(String actionType) {
        this.actionType = actionType;
    }

    public String getStartCommand() {
        return startCommand;
    }

    public void setStartCommand(String startCommand) {
        this.startCommand = startCommand;
    }

    public String getStopCommand() {
        return stopCommand;
    }

    public void setStopCommand(String stopCommand) {
        this.stopCommand = stopCommand;
    }

    public Integer getOrdinalPosition() {
        return ordinalPosition;
    }

    public void setOrdinalPosition(Integer ordinalPosition) {
        this.ordinalPosition = ordinalPosition;
    }

    public Long getCrontabId() {
        return crontabId;
    }

    public void setCrontabId(Long crontabId) {
        this.crontabId = crontabId;
    }

    public String getCrontabName() {
        return crontabName;
    }

    public void setCrontabName(String crontabName) {
        this.crontabName = crontabName;
    }

    public Date getScheduleTime() {
        return scheduleTime;
    }

    public void setScheduleTime(Date scheduleTime) {
        this.scheduleTime = scheduleTime;
    }

    public Date getScheduleStartTime() {
        return scheduleStartTime;
    }

    public void setScheduleStartTime(Date scheduleStartTime) {
        this.scheduleStartTime = scheduleStartTime;
    }

    public Date getScheduleStopTime() {
        return scheduleStopTime;
    }

    public void setScheduleStopTime(Date scheduleStopTime) {
        this.scheduleStopTime = scheduleStopTime;
    }

    public String getCreateMode() {
        return createMode;
    }

    public void setCreateMode(String createMode) {
        this.createMode = createMode;
    }

    public Date getLaunchTime() {
        return launchTime;
    }

    public void setLaunchTime(Date launchTime) {
        this.launchTime = launchTime;
    }

    public Date getStartTime() {
        return startTime;
    }

    public void setStartTime(Date startTime) {
        this.startTime = startTime;
    }

    public String getShutdownMode() {
        return shutdownMode;
    }

    public void setShutdownMode(String shutdownMode) {
        this.shutdownMode = shutdownMode;
    }

    public Date getShutdownTime() {
        return shutdownTime;
    }

    public void setShutdownTime(Date shutdownTime) {
        this.shutdownTime = shutdownTime;
    }

    public Date getStopTime() {
        return stopTime;
    }

    public void setStopTime(Date stopTime) {
        this.stopTime = stopTime;
    }

    public String getLogFileName() {
        return logFileName;
    }

    public void setLogFileName(String logFileName) {
        this.logFileName = logFileName;
    }

    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    public String getRestartTaskCreated() {
        return restartTaskCreated;
    }

    public void setRestartTaskCreated(String restartTaskCreated) {
        this.restartTaskCreated = restartTaskCreated;
    }

    public Integer getInstancePid() {
        return instancePid;
    }

    public void setInstancePid(Integer instancePid) {
        this.instancePid = instancePid;
    }

    public String getReturnCode() {
        return returnCode;
    }

    public void setReturnCode(String returnCode) {
        this.returnCode = returnCode;
    }

    public String getConflictFlag() {
        return conflictFlag;
    }

    public void setConflictFlag(String conflictFlag) {
        this.conflictFlag = conflictFlag;
    }

    public String getRemark() {
        return remark;
    }

    public void setRemark(String remark) {
        this.remark = remark;
    }

    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    public Date getModifyTime() {
        return modifyTime;
    }

    public void setModifyTime(Date modifyTime) {
        this.modifyTime = modifyTime;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", id=").append(id);
        sb.append(", parentId=").append(parentId);
        sb.append(", oldId=").append(oldId);
        sb.append(", hasRedo=").append(hasRedo);
        sb.append(", jobId=").append(jobId);
        sb.append(", jobType=").append(jobType);
        sb.append(", jobName=").append(jobName);
        sb.append(", hostName=").append(hostName);
        sb.append(", actionType=").append(actionType);
        sb.append(", startCommand=").append(startCommand);
        sb.append(", stopCommand=").append(stopCommand);
        sb.append(", ordinalPosition=").append(ordinalPosition);
        sb.append(", crontabId=").append(crontabId);
        sb.append(", crontabName=").append(crontabName);
        sb.append(", scheduleTime=").append(scheduleTime);
        sb.append(", scheduleStartTime=").append(scheduleStartTime);
        sb.append(", scheduleStopTime=").append(scheduleStopTime);
        sb.append(", createMode=").append(createMode);
        sb.append(", launchTime=").append(launchTime);
        sb.append(", startTime=").append(startTime);
        sb.append(", shutdownMode=").append(shutdownMode);
        sb.append(", shutdownTime=").append(shutdownTime);
        sb.append(", stopTime=").append(stopTime);
        sb.append(", logFileName=").append(logFileName);
        sb.append(", status=").append(status);
        sb.append(", restartTaskCreated=").append(restartTaskCreated);
        sb.append(", instancePid=").append(instancePid);
        sb.append(", returnCode=").append(returnCode);
        sb.append(", conflictFlag=").append(conflictFlag);
        sb.append(", remark=").append(remark);
        sb.append(", createTime=").append(createTime);
        sb.append(", modifyTime=").append(modifyTime);
        sb.append(", serialVersionUID=").append(serialVersionUID);
        sb.append("]");
        return sb.toString();
    }
}